package com.code.base.dic.service;

import java.util.List;
import java.util.Date;
import java.util.Map;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.code.base.dic.persistence.DicTypeMapper;
import com.code.base.dic.pojo.DicType;
import com.code.util.PrimaryKeyUtil;


@Service
public class DicTypeService {


	@Resource
	private DicTypeMapper dicTypeMapper;

	public Long getInsertId() {
		return PrimaryKeyUtil.generatePrimaryKey();
	}

	public DicType getDataById(Long id) {
		return dicTypeMapper.getDataById(id);
	}

	public List<DicType> getAllData() {
		return dicTypeMapper.getAllData();
	}

	public int getDataCountByCondition(DicType entity) {
		return dicTypeMapper.getDataCountByCondition(entity);
	}

	public List<DicType> getDataByCondition(DicType entity) {
		return dicTypeMapper.getDataByCondition(entity);
	}

	public int getDataCountByLikeCondition(DicType entity) {
		return dicTypeMapper.getDataCountByLikeCondition(entity);
	}

	public List<DicType> getDataByLikeCondition(DicType entity) {
		return dicTypeMapper.getDataByLikeCondition(entity);
	}

	public List<DicType> getDataByIds(Long[] ids) {
		return dicTypeMapper.getDataByIds(ids);
	}

	public void insertData(DicType entity) {
		insertData(entity, true);
	}

	public void insertData(DicType entity, boolean setIdValue) {
		if (setIdValue) {
			entity.setId(getInsertId());
		}
		dicTypeMapper.insertData(entity);
	}

	public void updateData(DicType entity) {
		dicTypeMapper.updateData(entity);
	}

	public void updateDataByParam(Map<String, Object> map) {
		if (map.size() == 0)
			return;

		dicTypeMapper.updateDataByParam(map);
	}

	public void deleteDataByObject(DicType entity) {
		dicTypeMapper.deleteDataByObject(entity);
	}

	public void deleteDataById(Long id) {
		dicTypeMapper.deleteDataById(id);
	}

	public void deleteDataByIds(Long[] ids) {
		dicTypeMapper.deleteDataByIds(ids);
	}

}
